package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.CategoryDTO;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import com.sky.entity.Employee;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {
    //修改

    //分页
    Page<Category> pageQuery(CategoryPageQueryDTO categoryPageQueryDTO);

    @Update("update category set name =#{name},sort=#{sort},update_time=#{updateTime} where id=#{id}")
    void updateCategoryInfo(Category category);

    @Update("update category set status=#{status} where id=#{id}")
    void stopAndStar(Integer status, Integer id);

    @Delete("delete from category where id=#{id}")
    void removeCatrgory(Integer id);

    @Insert("insert into category(type, name, sort, status, create_time, update_time, create_user, update_user) values " +
            "(#{type},#{name},#{sort},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void addCategory(Category category);

//    @Select("select * from category where type=#{type}")
    List<Category> findList(Integer type);

}
